package com.letv.core.network.volley;

/**
 * 重试策略
 * 
 * @author zhuqiao
 * 
 */
public class RetryPolicy {
    /** 默认的最大重试次数 **/
    private static final int DEFAULT_MAX_RETRIES = 0;

    /** 最大的重试次数 **/
    private int mMaxNumRetries = DEFAULT_MAX_RETRIES;

    /** 当前重试次数 **/
    private int mCurrentRetryCount;

    public void setMaxRetries(int maxNumRetries) {
        mMaxNumRetries = maxNumRetries;
    }

    /**
     * 重试
     */
    public boolean retry() {
        mCurrentRetryCount++;
        return mCurrentRetryCount <= mMaxNumRetries;
    }

    public int getRetries() {
        return mCurrentRetryCount;
    }
}
